package com.example.demo.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Fun {
    private int fid;
    private String fName;
    private List<Role> js;
    private Funtype gnlx;

    @Id
    @Column(name = "fid", nullable = false)
    public int getFid() {
        return fid;
    }

    public void setFid(int fid) {
        this.fid = fid;
    }

    @Basic
    @Column(name = "fName", nullable = true, length = 30)
    public String getfName() {
        return fName;
    }

    public void setfName(String fName) {
        this.fName = fName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fun fun = (Fun) o;
        return fid == fun.fid &&
                Objects.equals(fName, fun.fName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fid, fName);
    }

    @ManyToMany(mappedBy = "gn")
    public List<Role> getJs() {
        return js;
    }

    public void setJs(List<Role> js) {
        this.js = js;
    }

    @ManyToOne
    @JoinColumn(name = "ftId", referencedColumnName = "ftId")
    public Funtype getGnlx() {
        return gnlx;
    }

    public void setGnlx(Funtype gnlx) {
        this.gnlx = gnlx;
    }
}
